// delay 毫秒后执行resolve
function timerPromisefy (delay) {
    return new Promise(function (resolve) {
        setTimeout(() => {
            resolve(delay)
        }, delay);
    })
}

var startDate = Date.now()

// 所有 promise 变为 resolve 后程序退出
Promise.all([
    timerPromisefy(1),
    timerPromisefy(32),
    timerPromisefy(64),
    timerPromisefy(128)
]).then(function (values) {
    console.log(Date.now() - startDate + 'ms');
    // 约128ms
    console.log(values);
})